package cn.yunhe.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;


@Entity(name = "房屋类型")
@Table(name = "type")
public class Type implements Serializable {
    private int tid;
    private String tname;

    private Set<House>houseSet=new HashSet<>();

    public Type() {
    }

    public Type(String tname) {
        this.tname = tname;
    }

    public Type(int tid, String tname) {
        this.tid = tid;
        this.tname = tname;
    }

    @Id
    @GeneratedValue
    @Column(name = "tid")
    public int getTid() {
        return tid;
    }

    public void setTid(int tid) {
        this.tid = tid;
    }

    @Column(name = "tname")
    public String getTname() {
        return tname;
    }

    public void setTname(String tname) {
        this.tname = tname;
    }

    @OneToMany(fetch = FetchType.LAZY,mappedBy = "type")
    /*@JoinColumn(name = "htid")*/
    public Set<House> getHouseSet() {
        return houseSet;
    }

    public void setHouseSet(Set<House> houseSet) {
        this.houseSet = houseSet;
    }
}
